<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">

    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('News/index')}">新闻公告列表管理</a></li>
        <li ><a href="{:url('News/add')}">添加新闻</a></li>
    </ul>

    <form class="well form-inline margin-top-20" method="get" action="{:url('News/index')}">
        <input type="text" class="form-control" name="keyword" style="width: 200px;" value="" placeholder="支持标题，作者搜索">
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:url('News/index')}">清空</a>
    </form>

    <form method="post" action="{:url('News/px')}" class="js-ajax-form margin-top-20" >
        <div class="table-actions">
            <button type="submit" class="btn btn-primary btn-sm js-ajax-submit">排序</button>
        </div>
        <div style="margin: 10px 0;">
            <div style="margin: 10px 0;"></div>
            <table class="table table-hover table-bordered table-list">

                <thead>
                <tr>
                    <th><input type="checkbox" onclick="checkAll(this)"></th>
                    <th>排序</th>
                    <th>ID</th>
                    <th>标题</th>
                    <th>图片</th>
                    <th>浏览量</th>
                    <th>作者</th>
                    <th>是否展示</th>
                    <th>时间</th>
                    <th>操作</th>
                </tr>
                </thead>

                <tbody>
                    <foreach name="list" item="vo">
                        <tr>
                            <td><input type="checkbox" name="id[]" value="{$vo.id}"></td>
                            <td><input type="text" name="list_orders[{$vo.id}]" value="{$vo.list_order}" class="input-order"></td>
                            <td>{$vo.id}</td>
                            <td width="300px">{$vo.title}</td>
                            <td><img src="{$vo.image}" class="img-thumbnail js-image-previewer" width="100px" height="100px" /></td>
                            <td>{$vo.look_num}</td>
                            <td>{$vo.author}</td>
                            <td>
<!--                                <eq name="$vo.switch" value="1">-->
<!--                                    <button type="">是</button>-->
<!--                                </else>-->
<!--                                    <button type="">否</button>-->
<!--                                </eq>-->

                                <switch name="$vo.switch">
                                    <case value="0">
                                        <a href="{:url('News/show',array('id'=>$vo['id']))}" class="js-ajax-dialog-btn" data-msg="是否展示"  >
                                            <span class="btn btn-success"> 是 </span>
                                        </a>
                                    </case>
                                    <case value="1">
                                        <a href="{:url('News/show',array('id'=>$vo['id']))}" class="js-ajax-dialog-btn" data-msg="是否展示"  >
                                            <span class="btn btn-danger"> 否 </span>
                                        </a>
                                    </case>
                                </switch>

                            </td>
                            <td>{$vo.create_time}</td>
                            <td>
                                <a onclick="openIframeDialog('{:url("News/content",array('id'=>$vo['id']))}','正文查看')">
                                    <span class="btn btn-xs btn-primary" title="正文显示" data-toggle="tooltip">
                                        正文查看
                                    </span>
                                </a>

                                <a href="{:url('News/edit',array('id'=>$vo['id']))}">
                                    <span class="btn btn-xs btn-primary" title="{:lang('EDIT')}" data-toggle="tooltip">
                                        <i class="fa fa-edit fa-fw"></i>
                                    </span>
                                </a>

                                <a href="{:url('News/delete',array('id'=>$vo['id']))}" class="btn btn-xs btn-danger js-ajax-delete" data-toggle="tooltip" title="{:lang('DELETE')}" data-msg="确定删除吗？">
                                    <span>
                                    <i class="fa fa-trash fa-fw"></i>
                                    </span>
                                </a>
                            </td>
                        </tr>
                    </foreach>
                </tbody>

            </table>
            <div class="pagination">
                {$list->render()}
            </div>
        </div>
    </form>

</div>
    <script type="text/javascript" src="__STATIC__/js/js-image-previewer.js"></script>
    <script type="text/javascript" src="__STATIC__/js/admin.js?v={}"></script>


    <script>
        function checkAll(obj){
            var checkbox = document.getElementsByName('id[]')
            for(let i = 0; i<checkbox.length; i++){
                checkbox[i].checked = obj.checked;
            }
        }


    </script>

</body>
</html>
